
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>商品库存明细报表</title>
	<link rel="stylesheet" type="text/css" href="../../rs/plugins/easyui/themes/metro/easyui.css">
	<link rel="stylesheet" type="text/css" href="../../rs/plugins/easyui/themes/icon.css">
	<link href="../../rs/css/bootstrap.min.css" rel="stylesheet">
	<link href="../../rs/plugins/datapicker/datepicker3.css" rel="stylesheet">
	<script type="text/javascript" src="../../rs/plugins/easyui/jquery.min.js"></script>
	<script type="text/javascript" src="../../rs/plugins/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../../rs/plugins/easyui/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="../../rs/plugins/easyui/datagrid-groupview.js"></script>
	<script src="../../rs/js/jquery.cookie.js"></script>
	<script src="../../rs/js/common_qj.js"></script>
	<style>
		html,body{ margin:0px; height:100%;}
	</style>
	<?php
  		require_once('login.php');
 	?>
</head>
<body >
<table id="table" class="easyui-datagrid"  style="width:100%;height:100%;padding: 10px;"
	   data-options="
			rownumbers:true,
			singleSelect:'false',
			method:'get' ,
			toolbar:'#easyui_toolbar',
			fit:true,
			fitColumns:true,
	        fit:'true',
	        showFooter:true
	        ">
	<thead>
	<tr>

		<th data-options="field:'编号',width:30,align:'center'">编号</th>
		<th data-options="field:'型号',width:30,align:'center'">型号</th>
		<th data-options="field:'品名',width:60,left:'center'">品名</th>
		<th data-options="field:'库存店',width:30,align:'center'">库存店</th>
		<th data-options="field:'类别',width:30,align:'center'">类别</th>
		<th data-options="field:'库存数',width:30,align:'center'">库存数</th>

	</tr>
	</thead>
</table>

<div id="easyui_toolbar" region="north" border="false"
	 style="height: 45px;padding: 5px 5px; ">
	<div style="float:left;">
		<button onClick="expert_excel()" class="btn dropdown-toggle"  style=" border-radius: 0px; height:34px" type="button"  >
			<i class="glyphicon glyphicon-export icon-share"></i>
		</button>
	</div>


	<div class="col-sm-4"  >
		<div class=" draggable">
			<div class="input-group ">
				<span class="input-group-btn">
					<button style="height:34px;background-color: #FFF;border: 1px solid #e5e6e7;font-size: 14px" type="button" class="btn btn-sm ">门店号</button>
				</span>
				<select class="form-control" id="mdbh"></select>
			</div>
		</div>
	</div>




	<div id="tb" class="input-group" style="float: right; margin-right: 10px;width:50px">

		<div class="input-group-btn">
			<button type="button" class="btn btn-white dropdown-toggle" onclick="do_search()" style="border-radius: 0px;">
				执行
			</button>

		</div>
	</div>


</div>


<!--页面加载缓冲图标-->
<div id='loadingDiv' style="position:absolute;z-index:1000;top:0px; left:0px;
	width:100%;height:100%;background:white;text-align: center;">
	<h1 style="top: 30%; position: relative;">
		<img src="../../rs/img/loading-2.gif" /><br>
	</h1>
</div>
<script src="../../rs/plugins/datapicker/bootstrap-datepicker.js"></script>
<script>

	/*页面加载缓冲*/
	function closeLoading() {
		$("#loadingDiv").fadeOut("normal", function () {
			$(this).remove();
		});
	}
	var no;
	$.parser.onComplete = function () {
		if (no) clearTimeout(no);
		no = setTimeout(closeLoading, 1000);
	}

	var sign = URLencode($.cookie('sign'));






	$(function(){
		if(sign==="undefined"){
			window.location.href = "login.html";
		}
		sel_mdbh();
	});


	function sel_mdbh(){
		$.ajax({
			type: "post",
			url:G_url+'repo/getshop',
			data:'sign='+sign,
			dataType: "json",
			success: function (data){

				//给门店编号做循环
				var ff = data.rows;
				var html = '';
				$.each(ff, function (a, b) {//直接取出json的prolist做each循环.
					html += "<option value='"+b.shopid+"'>" + b.shopname + "</option>";//拼接字符串.
				});
				$("#mdbh").append(html);
			},
			error: function (XMLHttpRequest, textStatus, errorThrown) {
			}
		});
	}








	function do_search(){
	 var shop=$('#mdbh').val();
	 layer.msg('数据加载中...', {icon: 16, time: 200000, shade: [0.1, 'black']});
	 $.ajax({
		 type: "post",
		 url:G_url+'repokc/kcmx?sign='+sign,
		 data: "shop="+shop,
		 dataType: "json",
		 success: function (result){
			 $('#table').datagrid({
				 data: result
			 });
			 layer.closeAll();
		 },
		 error: function (XMLHttpRequest, textStatus, errorThrown) {

		 }
	 });
	 }


	function pagerFilter(data){
		if (typeof data.length == 'number' && typeof data.splice == 'function'){	// is array
			data = {
				total: data.length,
				rows: data
			}
		}
		var dg = $(this);
		var opts = dg.datagrid('options');
		var pager = dg.datagrid('getPager');
		pager.pagination({
			onSelectPage:function(pageNum, pageSize){
				opts.pageNumber = pageNum;
				opts.pageSize = pageSize;
				pager.pagination('refresh',{
					pageNumber:pageNum,
					pageSize:pageSize
				});
				dg.datagrid('loadData',data);
			}
		});
		if (!data.originalRows){
			data.originalRows = (data.rows);
		}
		var start = (opts.pageNumber-1)*parseInt(opts.pageSize);
		var end = start + parseInt(opts.pageSize);
		data.rows = (data.originalRows.slice(start, end));
		return data;
	}







</script>

<script src="../../rs/plugins/layer/layer.min.js"></script>
<script src="../../rs/js/bootstrap.js"></script>
<script src="../../rs/plugins/md5.js"></script>
<script src="../../rs/plugins/tableExport.js"></script>
</body>
</html>
